package net.framework.smc.demo.controller;

import lombok.extern.slf4j.Slf4j;
import net.framework.smc.demo.po.ResultPo;
import net.framework.smc.demo.service.UserService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;

import java.util.Map;

/**
 * @authore zyx
 * @date 2018/6/28 11:43
 */
@RestController
@Slf4j
@RequestMapping("/user")
public class UserController {


    @Autowired
    UserService userService;

    @RequestMapping(value = "/login", method = RequestMethod.GET)
    public ResultPo login(@RequestParam Map<String, String> param) {
        try {
            return userService.login(param);
        }catch (Exception e) {
            log.error(e.toString());
            return ResultPo.error("用户名或密码错误！");
        }
    }


}
